package com.lsfb.signln.Leave.AddLeave;

import android.content.Intent;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.lsfb.signln.R;
import com.lsfb.signln.Utils.LittleUtils;
import com.zgscwjm.lsfbbasetemplate.LsfbActivity;
import com.zgscwjm.lsfbbasetemplate.annotation.ContentView;
import com.zgscwjm.lsfbbasetemplate.annotation.ViewInject;

import java.util.ArrayList;
import java.util.List;

@ContentView(R.layout.aty_hyx_leave_type)
public class LeaveTypeActivity extends LsfbActivity implements LeaveTypeAdapter.ItemClickListener {

    /**
     * 请假类型列表
     */
    @ViewInject(R.id.rv_leaveType)
    private RecyclerView rv_leaveType;
    private List<String> types;
    private LeaveTypeAdapter adapter;

    /**
     * 返回Activity的请求码
     */
    private int requestCode = 0;

    @Override
    public void initView() {
        LittleUtils.setsimpletitlebar(this, "选择免定位类型");

        String[] string = {"因事", "因病", "年休", "其他"};
        types = new ArrayList<>();
        for (int i = 0; i < 4; i++) {
            types.add(string[i]);
        }
        adapter = new LeaveTypeAdapter(this, types, R.layout.item_hyx_reasons, this);
        rv_leaveType.setLayoutManager(new LinearLayoutManager(this));
        rv_leaveType.setAdapter(adapter);
    }

    @Override
    public void initEvent() {

    }

    @Override
    public void initData() {

    }

    @Override
    public void onClick(String model, int position) {
        Intent intent = new Intent();
        intent.putExtra("datas", model);
        intent.putExtra("id", position);
        setResult(requestCode, intent);
        finish();
    }
}
